﻿<fluent:RibbonTabItem x:Class="XSemmel.TreeView.Ribbon.TreeViewTab"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
            xmlns:TreeView="clr-namespace:XSemmel.TreeView.Commands" 
            xmlns:fluent="clr-namespace:Fluent;assembly=Fluent"
            mc:Ignorable="d" 
            Header="TreeView">
    <fluent:RibbonTabItem.Resources>
        <TreeView:CommentOutCommand x:Key="CommentOutCommand"/>
        <TreeView:RenameCommand x:Key="RenameCommand"/>
        <TreeView:CollapseAllCommand x:Key="CollapseAllCommand"/>
        <TreeView:ExpandAllCommand x:Key="ExpandAllCommand"/>
        <TreeView:ExpandToLevel1Command x:Key="ExpandToLevel1Command"/>
        <TreeView:ExpandToLevel2Command x:Key="ExpandToLevel2Command"/>
        <TreeView:ExpandToLevel3Command x:Key="ExpandToLevel3Command"/>
        <TreeView:ExpandToLevel4Command x:Key="ExpandToLevel4Command"/>
        <TreeView:CopyXPathCommand x:Key="CopyXPathCommand"/>
        <TreeView:MoveUpCommand x:Key="MoveUpCommand"/>
        <TreeView:MoveDownCommand x:Key="MoveDownCommand"/>
        <TreeView:SelectCodeCommand x:Key="SelectCodeCommand"/>
        <TreeView:ShowSchemaInfoCommand x:Key="ShowSchemaInfoCommand"/>
        <TreeView:DeleteCommand x:Key="DeleteCommand"/>
        <TreeView:UpdateCommand x:Key="UpdateCommand"/>
    </fluent:RibbonTabItem.Resources>
    
    <fluent:RibbonGroupBox Header="Selected item">
        <fluent:Button
            Header="Copy XPath"
            Icon="/Images/112_ArrowCurve_Blue_Right_16x16_72.png"
            LargeIcon="/Images/112_ArrowCurve_Blue_Right_32x32_72.png"
            Command="{StaticResource CopyXPathCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"                        
        />
        <fluent:Button
            Header="Select in editor"
            Icon="/Images/View_16x16.png"
            LargeIcon="/Images/View_32x32.png"
            Command="{StaticResource SelectCodeCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"                        
        />
        <fluent:Button
            Header="Show schema info"
            Icon="/Images/BookVshelp_16x16.png"
            LargeIcon="/Images/BookVshelp_32x32.png"
            Command="{StaticResource ShowSchemaInfoCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
        <fluent:Button
            Header="Comment out"
            Icon="/Images/Comment_16x16.png"
            SizeDefinition="Middle, Small"
            Command="{StaticResource CommentOutCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"                        
        />
        <fluent:Button
            Header="Rename"
            Icon="/Images/RenameFolderHS.png"
            SizeDefinition="Middle, Small"
            Command="{StaticResource RenameCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"                        
        />
        <fluent:Button
            Header="Delete"
            Icon="/Images/Delete_16x16.png"
            SizeDefinition="Middle, Small"
            Command="{StaticResource DeleteCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
    </fluent:RibbonGroupBox>

    <fluent:RibbonGroupBox Header="View">
        <fluent:Button
            Header="Update"
            Icon="/Images/112_RefreshArrow_Blue_16x16_72.png"
            LargeIcon="/Images/112_RefreshArrow_Blue_32x32.png"
            Command="{StaticResource UpdateCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
        <fluent:CheckBox
            Header="Update automatically"
            SizeDefinition="Middle, Small"
            IsChecked="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data.UpdateTreeViewAutomatically}"
        />

        <fluent:SplitButton Header="Expand all"
                            Icon="/Images/ExpandAll_16x16.png"
                            SizeDefinition="Middle, Small"
                            Command="{StaticResource ExpandAllCommand}"
                            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}">
            <fluent:SplitButton.Items>
                <fluent:MenuItem Header="Expand to level 1"
                    Command="{StaticResource ExpandToLevel1Command}"
                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"/>
                <fluent:MenuItem Header="Expand to level 2"
                    Command="{StaticResource ExpandToLevel2Command}"
                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"/>
                <fluent:MenuItem Header="Expand to level 3"
                    Command="{StaticResource ExpandToLevel3Command}"
                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"/>
                <fluent:MenuItem Header="Expand to level 4"
                    Command="{StaticResource ExpandToLevel4Command}"
                    CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"/>
            </fluent:SplitButton.Items>
        </fluent:SplitButton>

        <fluent:Button
            Header="Collapse all" 
            Icon="/Images/CollapseAll_16x16.png"
            SizeDefinition="Middle, Small"
            Command="{StaticResource CollapseAllCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"                        
        />
    </fluent:RibbonGroupBox>

    <fluent:RibbonGroupBox Header="Move selected item">
        <fluent:Button
            Header="Move up"
            Icon="/Images/Up_16x16.png"
            SizeDefinition="Middle, Small"
            Command="{StaticResource MoveUpCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
        <fluent:Button
            Header="Move down"
            Icon="/Images/Down_16x16.png"
            SizeDefinition="Middle, Small"
            Command="{StaticResource MoveDownCommand}"
            CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type fluent:RibbonWindow}}, Path=Data}"
        />
    </fluent:RibbonGroupBox>

</fluent:RibbonTabItem>
